import React,{useEffect,useState} from 'react'
import {useSearchParams} from 'react-router-dom'
import api from '../../api'

export default function UserDetail() {
  let [params]=useSearchParams()
  const [user,setUser]=useState(null)
  useEffect(()=>{
    getUserById()
  },[])
  const getUserById=async ()=>{
   let result=await api.users.getUserById(params.get('id'))  
   setUser(result.data)
  }
  return (
    <div>
        {user?<>
            <div>账户:{user.account}</div>
        <div>
            <img src={user.imgUrl} alt="" />
        </div>
        </>:<></>}
    </div>
  )
}
